<!--
 * @Author: feng.gan 675198494@qq.com
 * @Date: 2024-07-17 14:47:34
 * @LastEditors: feng.gan 675198494@qq.com
 * @LastEditTime: 2025-04-30 09:46:46
 * @FilePath: \vue3-demo\src\App.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <el-container class="layout-container-demo">
    <el-aside width="200px">
      <el-scrollbar>
        <el-menu :default-openeds="['1','3']" router>
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <message />
              </el-icon>
              分组1
            </template>
            <el-menu-item v-for="r in routes" :index="r.path" :key="r.path">{{ r.name }}</el-menu-item>
          </el-sub-menu>
        </el-menu>
      </el-scrollbar>
    </el-aside>
    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <div class="toolbar">
          <el-dropdown>
            <el-icon style="margin-right: 8px; margin-top: 1px">
              <setting />
            </el-icon>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item>View</el-dropdown-item>
                <el-dropdown-item>Add</el-dropdown-item>
                <el-dropdown-item>Delete</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
          <span>Tom</span>
        </div>
      </el-header>
      <el-main>
        <router-view/>
      </el-main>
    </el-container>
  </el-container>
</template>

<script lang="ts" setup>
import { routes } from '@/router'
import { Message,Setting } from '@element-plus/icons-vue'

const request = () => {
  return new Promise((resolve,reject) => {
    const value = Math.random()
    if (value > 0.5) {
      resolve(value)
    } else {
      reject(value)
    }
  })
}
const hello = 'ff'
Promise.allSettled([request(),request()]).then(res => {
  console.log(res)
}).catch(error => {
  console.log(error)
})
</script>

<style scoped lang="less">
.layout-container-demo {
  height: 100vh;

  .el-header {
    position: relative;
    background-color: var(--el-color-primary-light-7);
    color: var(--el-text-color-primary);
  }

  .el-aside {
    color: var(--el-text-color-primary);
    background: var(--el-color-primary-light-8);
  }

  .el-menu {
    border-right: none;
  }

  .el-main {
    padding: 0;
  }

  .toolbar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    right: 20px;
  }
}
</style>
